#include "modules/calibration/lidar_imu_calibrator/include/version_modal.h"

#include "modules/calibration/lidar_imu_calibrator/include/version.h"

namespace lidar_imu_calibrator {

VersionModal::VersionModal() {}

VersionModal ::~VersionModal() {}

void VersionModal::Open() { ImGui::OpenPopup("Lidar IMU Calibrator"); }

bool VersionModal::Run() {
  bool close_modal = false;
  ImGuiWindowFlags flags =
      ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar;
  if (ImGui::BeginPopupModal("Lidar IMU Calibrator", nullptr, flags)) {
    ImGui::Text("Lidar IMU Calibrator");
    ImGui::Text("Version: %d.%d.%d", IS_VERSION_MAJOR, IS_VERSION_MINOR,
                IS_VERSION_REVISION);
    // ImGui::Text("Commit hash: %s", LAST_COMMIT_HASH);
    // ImGui::Text("Commit date: %s", LAST_COMMIT_DATE);
    // ImGui::Text("\nK.Koide (k.koide@aist.go.jp)");
    // ImGui::Text("Smart Mobility Research Team");
    // ImGui::Text("AIST, Japan");

    if (ImGui::Button("OK")) {
      ImGui::CloseCurrentPopup();
      close_modal = true;
    }
    ImGui::EndPopup();
  }

  return close_modal;
}
}  // namespace lidar_imu_calibrator